package com.cn.xact.ty_treasured_book.util;

import com.cn.xact.ty_treasured_book.R;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

public class UIHelper {

    private static boolean mIsConfirmDialogShowing = false;

    public static void showConfirmDialog(Context context, String title, String message) {
        if (mIsConfirmDialogShowing)
            return;
        AlertDialog.Builder build = new AlertDialog.Builder(context);
        build.setTitle(title);
        build.setMessage(message);
        build.setPositiveButton(context.getResources().getString(R.string.OK), new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                mIsConfirmDialogShowing = false;
                dialog.dismiss();
            }
        });

        build.show();
        mIsConfirmDialogShowing = true;
    }
}